#!/bin/sh
if [ "$(uci -q get wifi-iface.radio0)" != "" ] && [ "$(uci -q get wifi-iface.default_radio0.key)" = "12345678" ]; then
	if [ "$(uci -q get wifi-device.radio0.country)" = "" ]; then
		uci -q batch <<-EOF >/dev/null
			set wifi-device.radio0.country='FR'
			commit wifi-device
		EOF
	fi
	if [ -n "$(uci -q get wifi-iface.radio0.network | grep lan)" ]; then
		uci -q batch <<-EOF >/dev/null
			set wifi-iface.default_radio0.network='wifi'
			commit wifi-iface
		EOF
	fi
	if [ -n "$(uci -q get wifi-device.radio0.cell_density)" ]; then
		uci -q batch <<-EOF >/dev/null
			delete wifi-device.radio0.cell_density
			commit wifi-device
		EOF
	fi
fi

exit 0
